package com.ruoyi.match.service.impl;

import java.util.List;

import com.ruoyi.match.domain.MatchAttachments;
import com.ruoyi.match.mapper.MatchAttachmentsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.match.mapper.MatchWoekMapper;
import com.ruoyi.match.domain.MatchWoek;
import com.ruoyi.match.service.IMatchWoekService;
import com.ruoyi.common.core.text.Convert;

/**
 * 作品Service业务层处理
 * 
 * @author 星野漫游
 * @date 2024-06-02
 */
@Service
public class MatchWoekServiceImpl implements IMatchWoekService 
{
    @Autowired
    private MatchWoekMapper matchWoekMapper;


    @Autowired
    private MatchAttachmentsMapper matchAttachmentsMapper;

    /**
     * 查询作品
     * 
     * @param workId 作品主键
     * @return 作品
     */
    @Override
    public MatchWoek selectMatchWoekByWorkId(Long workId)
    {
        return matchWoekMapper.selectMatchWoekByWorkId(workId);
    }

    /**
     * 查询作品列表
     * 
     * @param matchWoek 作品
     * @return 作品
     */
    @Override
    public List<MatchWoek> selectMatchWoekList(MatchWoek matchWoek)
    {
        return matchWoekMapper.selectMatchWoekList(matchWoek);
    }

    /**
     * 新增作品
     * 
     * @param matchWoek 作品
     * @return 结果
     */
    @Override
    public int insertMatchWoek(MatchWoek matchWoek)
    {
        return matchWoekMapper.insertMatchWoek(matchWoek);
    }

    /**
     * 修改作品
     * 
     * @param matchWoek 作品
     * @return 结果
     */
    @Override
    public int updateMatchWoek(MatchWoek matchWoek)
    {
        return matchWoekMapper.updateMatchWoek(matchWoek);
    }

    /**
     * 批量删除作品
     * 
     * @param workIds 需要删除的作品主键
     * @return 结果
     */
    @Override
    public int deleteMatchWoekByWorkIds(String workIds)
    {
        return matchWoekMapper.deleteMatchWoekByWorkIds(Convert.toStrArray(workIds));
    }

    /**
     * 删除作品信息
     * 
     * @param workId 作品主键
     * @return 结果
     */
    @Override
    public int deleteMatchWoekByWorkId(Long workId)
    {
        return matchWoekMapper.deleteMatchWoekByWorkId(workId);
    }

    /**
     * 查看作品详情
     *
     * @param matchWoek
     * @return
     */
    @Override
    public List<MatchAttachments> chechDetails(MatchWoek matchWoek) {
        List<MatchAttachments> attachmentsList=matchAttachmentsMapper.getByWorkName(matchWoek.getWorkName());

        return attachmentsList;
    }
}
